package com.puzzlebazar.client.util;

import com.google.gwt.user.client.ui.Grid;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.Label;

public class StaticFieldImpl implements Field {

	protected final Label label ;
	protected final Label entry ;
	

	/**
	 * Creates a labeled field with the specified label and a specific text box
	 * 
	 * @param labelText The text to put in the label
	 * @param contentText The text to put in the content
	 */
	public StaticFieldImpl( String labelText, String entryText ) {
		label = new Label( labelText );	
		entry = new Label( entryText );	
		initialize();
	}
	

	/**
	 * Initialize the field, should only be called by the constructor
	 */
	private void initialize() {
		label.setStylePrimaryName( "entryLabel" );
	}
	
	@Override
	public void setEntry( String entryText ) {
		entry.setText( entryText );
	}
	
	
	@Override
	public void addToGrid( Grid grid, int row ) {		

		grid.setWidget( row, 0, label );
		grid.setWidget( row, 1, entry );
		grid.setWidget( row, 2, new HTML("&nbsp;") );

	}

}
